#ifndef _IMAGEMENU_H_
#define _IMAGEMENU_H_

#include <interfacelib/window/window.h>

#include <D3D9.h>
#include <d3dx9core.h>

#include <utillib/string/string.h>
#include <interfacelib/window/Panel.h>

#pragma warning ( disable : 4786 )
#include <deque>
#include <functional>

namespace interfacelib
{
	namespace Window
	{
		class ImageMenu : public Panel
		{
		private:
			struct MenuItem
			{
				int index;
				RECT rect;
				void *reserve;
			};
			typedef std::deque < MenuItem * > dequeMenuItem;
		public:
			ImageMenu();
			virtual ~ImageMenu();

			bool createCursor( const char *imageName, BYTE alphaValue = 0x80 );
			
			void addMenu( int index, RECT *rect, void *reserve = NULL );
			void removeMenu( int index ); 
			void setMenuItem( int index, RECT *rect = NULL, void *reserve = NULL);

			void *getItemData( int index );
			
			virtual void onMouseMove( UINT flags, POINT point );
			virtual	void onLButtonUp( UINT flags, POINT point );
			void onMouseOut( LONG x, LONG y );
			
			MenuItem* getcurrentItem()   {  return m_currentMousePointMenu;		};
		private:
			void release();

			MenuItem *getMenuItemPos( DWORD x,  DWORD y );
			dequeMenuItem m_menuItemList;

			MenuItem *m_currentMousePointMenu;
			interfacelib::Window::Window *m_cursorWindow;
		};
	}
}

#endif